import Service from '../../../core/baseService';

export default class FruitBillService extends Service {
  constructor(ctx) {
    super(ctx);
    this.model = ctx.sassmodel.FruitBillList;
  }

  async create(list) {
    if (list.length) {
      await this.model.destroy({ where: { bill_id: list[0].bill_id } });
      const result = await this.model.bulkCreate(list);
      return result;
    }
    return null;
  }

  async bulkUpdate(list) {
    if (list.length) {
      const result = await this.model.bulkCreate(list, { updateOnDuplicate: ['id'] });
      return result;
    }
  }

}
